﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using EuroManager.Domain.Simulator.Engine;

namespace EuroManager.Domain.Simulator.World
{
    [ContractClass(typeof(GameWorldContract))]
    public interface IGameWorld : ITimeAware
    {
        TimeSpan CurrentTime { get; }
        
        bool IsFinished { get; }

        IPitch Pitch { get; }

        IBall Ball { get; }

        ITeam Team1 { get; }

        ITeam Team2 { get; }

        IEnumerable<IPlayer> Players { get; }
    }

    [ContractClassFor(typeof(IGameWorld))]
    public abstract class GameWorldContract : IGameWorld
    {
        public abstract TimeSpan CurrentTime { get; }

        public abstract bool IsFinished { get; }

        public abstract IPitch Pitch { get; }

        public abstract IBall Ball { get; }

        public abstract ITeam Team1 { get; }

        public abstract ITeam Team2 { get; }

        public abstract IEnumerable<IPlayer> Players { get; }

        public abstract void Update(float elapsedTime);
    }
}
